<script setup lang="ts">
import { ref } from "vue";
import { formRules } from "../utils/rule";
import Multiple from "@/views/common/multiplePic.vue"
import uploadFile from "@/views/common/uploadFile.vue"
// 声明 props 类型
export interface FormProps {
  formInline: {
    diy_sales: string;
    remark: string;
    fileList: [];
    selectOrders: [];
    sales: [];
  };
}
const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({ diy_sales: "", remark: "",fileList: [] })
});

const newFormInline = ref(props.formInline);
const handleClose = (tag: string) => {
  newFormInline.value.selectOrders.splice(newFormInline.value.selectOrders.indexOf(tag), 1)
}
const ruleFormRef = ref();
function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <el-form :model="newFormInline"  ref="ruleFormRef" label-width="auto" :rules="formRules" size="small" style="max-width: 600px">
    <el-form-item label="订单编号" size="small">
      <el-tag v-for="tag in newFormInline.selectOrders" :key="tag.order_number" closable @close="handleClose(tag)" style="margin:2px 3px">
        {{ tag.order_number }}
      </el-tag>
    </el-form-item>
    <el-form-item label="选择业务员" prop="diy_sales">
      <el-select v-model="newFormInline.diy_sales" class="!w-[220px]" filterable clearable placeholder="选择业务员">
        <el-option v-for="item in newFormInline.sales" :label="item.name" :value="item.id" :disabled="item.status!=1" />
      </el-select>
    </el-form-item>
    <el-form-item label="备注信息" prop="remark">
      <el-input v-model="newFormInline.remark" :rows="2" type="textarea" placeholder="请输入备注信息"/>
    </el-form-item>
  </el-form>
</template>
